//
//  CaseManagerTableViewCell1.m
//  QuickCure
//
//  Created by 007 on 16/9/14.
//  Copyright © 2016年 haoge. All rights reserved.
//

#import "CaseManagerTableViewCell1.h"
#import <Masonry.h>
#import "Models.h"
@interface CaseManagerTableViewCell1()
@property (nonatomic ,weak)UILabel *detailText1;
@property (nonatomic ,weak)UILabel *detailText2;
@property (nonatomic ,weak)UILabel *currentTime;
@property (nonatomic ,weak)UILabel *textFieldContent;
@property (nonatomic ,weak)UIImageView *image;
@end
@implementation CaseManagerTableViewCell1

- (void)awakeFromNib
{
    [super awakeFromNib];
    // Initialization code
}

-(void)setModels:(Models *)models
{
    _models = models;
    [self setMySubViewData];
}

-(void)setMySubViewData
{
    Models *models = self.models;
    
    self.detailText2.text = models.detailText2;
    self.detailText1.text = models.detailText1;
    self.textFieldContent.text = models.textFieldContent;
    self.currentTime.text = models.currentTime;
    if (models.image != nil)
    {
        self.image.image = models.image;
    }
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    UIImageView *roundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"illness_rb_img_sel.png"]];
    [self.contentView addSubview:roundView];
    
    [roundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(@15);
        make.leading.equalTo(self.contentView).offset(10);
        make.top.equalTo(self.contentView);
    }];
    
    UIView *colLineView = [[UIView alloc] init];
    colLineView.backgroundColor = [UIColor colorWithRed:0.1333 green:0.7804 blue:0.7804 alpha:1.0];
    [self.contentView addSubview:colLineView];
    
    [colLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@1);
        make.top.equalTo(roundView.mas_bottom);
        make.height.equalTo(self.contentView.mas_height).multipliedBy(0.89);
        make.centerX.equalTo(roundView);
    }];
    
    //图片
    UIImageView *showImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    self.image = showImage;
    [self.contentView addSubview:showImage];
    
    [showImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView).multipliedBy(1.2);
        make.leading.equalTo(colLineView.mas_trailing).offset(20);
        make.width.height.equalTo(@80);
    }];
    
    
    //显示时间
    UILabel *showTime = [[UILabel alloc]init];
    showTime.textColor = [UIColor grayColor];
    self.currentTime = showTime;
    [self.contentView addSubview:showTime];
    
    [showTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(roundView.mas_trailing).offset(10);
        make.centerY.equalTo(roundView).multipliedBy(2);
    }];
    //疾病类型
    UILabel *illness = [[UILabel alloc]init];
    illness.text = @"疾病类型:";
    [self.contentView addSubview:illness];
    
    [illness mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(showImage.mas_trailing).offset(10);
        make.centerY.equalTo(showTime).multipliedBy(3);
    }];
    //所属科目
    UILabel *illness1 = [[UILabel alloc]init];
    self.detailText1 = illness1;
    illness1.textColor = [UIColor grayColor];
    [self.contentView addSubview:illness1];
    
    [illness1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(illness);
        make.leading.equalTo(illness.mas_trailing).offset(10);
    }];
    //基本类型
    UILabel *subKind = [[UILabel alloc]init];
    subKind.text = @"基本类型:";
    [self.contentView addSubview:subKind];
    
    [subKind mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(illness);
        make.centerY.equalTo(self.contentView).multipliedBy(1.1);
    }];
    //所属行
    UILabel *subKind1 = [[UILabel alloc]init];
    self.detailText2 = subKind1;
    subKind1.textColor = [UIColor grayColor];
    [self.contentView addSubview:subKind1];
    
    [subKind1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(illness1);
        make.centerY.equalTo(subKind);
    }];
    //详细信息
    UILabel *messLabel = [[UILabel alloc]init];
    messLabel.textColor = [UIColor grayColor];
    messLabel.font = [UIFont systemFontOfSize:15];
    self.textFieldContent = messLabel;
    [self.contentView addSubview:messLabel];
    
    [messLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(subKind);
        make.top.equalTo(subKind.mas_bottom).offset(10);
        make.trailing.equalTo(self.contentView.mas_trailing).offset(-50);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-20);
    }];
    
//    UILabel *label = [[UILabel alloc]init];
//    label.textColor = [UIColor grayColor];
//    self.textFieldContent = label;
//    [self.contentView addSubview:label];
//    UILabel *label1 = [[UILabel alloc]init];
//    label1.textColor = [UIColor grayColor];
//    self.detailText1 = label1;
//    [self.contentView addSubview:label1];
//    UILabel *label2 = [[UILabel alloc]init];
//    label2.textColor = [UIColor grayColor];
//    self.detailText2 = label2;
//    [self.contentView addSubview:label2];
//    UILabel *label3 = [[UILabel alloc]init];
//    label3.textColor = [UIColor grayColor];
//    self.currentTime = label3;
//    [self.contentView addSubview:label3];
//    UILabel *label4 = [[UILabel alloc]init];
//    label4.text = @"疾病类型:";
//    [self.contentView addSubview:label4];
//    UILabel *label5 = [[UILabel alloc]init];
//    label5.text = @"基本类型:";
//    [self.contentView addSubview:label5];
//
//    //显示时间
//    [label3 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView).offset(10);
//        make.top.equalTo(self.contentView);//.offset(10);
//        make.height.equalTo(@50);
//        make.width.equalTo(@200);
//    }];
//    [image1 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(label3.mas_bottom);
//        make.left.equalTo(self.contentView).offset(10);
//        make.width.equalTo(@80);
//        make.height.equalTo(@80);
//        
//    }];
//    //疾病类型
//    [label4 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(label3).offset(35);
//        make.left.equalTo(image1.mas_right).offset(25);
//        make.width.equalTo(@100);
//        make.height.equalTo(@50);
//    }];
//    [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(label4);
//        make.leading.equalTo(label4.mas_trailing).offset(-20);
//    }];
//    
//
//    //详细信心
//    [label5 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(label4).offset(35);
//        make.left.equalTo(image1.mas_right).offset(25);
//        make.width.equalTo(@100);
//        make.height.equalTo(@50);
//    }];
//    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(label5);
//        make.leading.equalTo(label5.mas_trailing).offset(-20);
//    }];
//    
//    
//    //留言
//    [label mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(label2).offset(20);
//        make.left.equalTo(image1.mas_right).offset(25);
//        make.width.equalTo(@200);
//        make.height.equalTo(@50);
//    }];
    
    return self;
}







@end
